home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / modeler / nearbg.lwm < prev    next >
Text File  |  1993-12-13  |  944b  |  54 lines

  1. /* CMD: Nearby Background
  2.  *
  3.  * Puts all nearby non-empty layers into the background of the current
  4.  * layers.
  5.  */
  6.     mxx="LWModelerARexx.port"
  7.     signal on error
  8.     signal on syntax
  9.     mxx_add = addlib(mxx,0)
  10.     call main
  11.     if (mxx_add) then call remlib(mxx)
  12.     exit
  13.  
  14.     syntax:
  15.     error:
  16.     t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
  17.     if (mxx_add) then call remlib(mxx)
  18.     exit
  19.  
  20.  
  21. main:
  22.  
  23. emp = emptylayers()
  24. cur = curlayer()
  25.  
  26. /* Keep adding adjacent layers to cur until all no more can
  27.  * be added.
  28.  */
  29. do until (nc = 0)
  30.     nc = 0
  31.     nl = ''
  32.     do i=1 to words(cur)
  33.     l = word(cur,i)
  34.     l1 = l + 1
  35.     if (l1<=8 & pos(l1,emp)=0 & pos(l1,cur nl)=0) then do
  36.         nl = nl l1
  37.         nc = nc + 1
  38.     end
  39.     l1 = l - 1
  40.     if (l1>0 & pos(l1,emp)=0 & pos(l1,cur nl)=0) then do
  41.         nl = nl l1
  42.         nc = nc + 1
  43.     end
  44.     end i
  45.     cur = cur nl
  46. end
  47.  
  48. /* SetBLayer automatically masks out currently active layers,
  49.  * so passing cur is ok.
  50.  */
  51. call setblayer cur
  52.  
  53. return
  54.